package com.acme.task3;

public class Task3Arrays {
	
	static double avg (int[] arr, int count) {
		double avg1 = 0;
		for (int i = 0; i < count; i++) {
			avg1 += arr[i];
		}
		avg1 = avg1 / count;
		return avg1;
	}
	
	public static void main(String[] args) {
		
		if (args.length > 1) {
			System.out.println("the wrong input");
			return;
		}

		for (int i = 1; i <= 50; i++) {
			System.out.println("Number " + i*3 + " is divisible by 3");
		}
		
		if (args.length > 0) {
			int n;
			try{
				n = Integer.parseInt(args[0]);				
			}
			catch (NullPointerException error) {
				System.out.println("the wrong input");
				return;
			}
			catch (NumberFormatException error2) {
				System.out.println("the wrong input");
				return;
			}
			
			int [] array = new int [n];
			for (int i = 1; i <= n; i++) {
				array[i-1] = i;
			}
			double avg_num = avg(array, n);
			System.out.println(avg_num);			 
		}
		
	}
}
